package spring.boot.shiro.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import spring.boot.shiro.entity.Permission;
import spring.boot.shiro.entity.User;
import spring.boot.shiro.repository.PermissionRep;

import java.util.List;

/**
 * Created by Administrator on 2018/6/10.
 */
@Service
public class PermissionService {

    @Autowired
    private PermissionRep permissionRep;

    public List<Permission> findAll(){
        return permissionRep.findAll();
    }

    public void addUser(Permission Permission){
        permissionRep.save(Permission);
    }

    public void updateUser(Permission Permission){
        permissionRep.save(Permission);
    }

    public Permission findById(Integer id){
        return permissionRep.getOne(id);
    }

    public void deleteUser(Integer id){
        permissionRep.deleteById(id);
    }

    public Permission findByName(String name){
        return permissionRep.findByName(name);
    }

}
